<template>
  <div>
    <a-card class="card" :bordered="false" :style="`min-height: ${cardMinHeight}px;`">

      <!--弹窗0 新增按钮-->
      <a-modal
          destroyOnClose
          class="addModal"
          v-model='addModal'
          width='800px'
          :title="isAdd?'新增':title"
          @ok="submit"
          @cancel="handleCancel0"
          :bodyStyle="bodyStyle"
      >
        <a-spin :spinning="spinning">
          <div style="width: 100%;min-height: 30px;display: flex;flex-direction: row;padding: 10px 24px 10px 24px;justify-content: space-between">
            <div style="width: 85%;">
              <a-form-model :model="addForm"  layout="inline">

                <a-form-model-item
                    class='optionTitle'
                    label="报修单编码"
                    required
                >
                  <a-input style='width: 200px;height: 32px' v-model='addForm.repairCode'  v-auth="`query`"></a-input>
                </a-form-model-item>

                <a-form-model-item
                    label="报修人"
                    style="margin-left: 40px;width: 100%">
                  <a-popover  trigger="click" placement="bottom" :overlayStyle="{ width: '250px' }">
                    <template slot="content">
                      <p class="aPopover" v-for="(item,index) in userSearchList" :key="index"  @click="changeUser(item)" >{{item.name}}</p>
                    </template>
                    <a-input style='width: 250px;height: 32px'
                             v-model.trim="addForm.order_user"
                             @keydown.enter="getUserList(addForm.order_user)"
                             @change="getUserList(addForm.order_user)"
                             allowClear
                             @click="getUserList(addForm.order_user)"
                             v-auth="`query`" ></a-input>
                  </a-popover>
                </a-form-model-item>

                <a-form-model-item
                    label="报修日期"
                    style="width: 100%;margin-left: 26px"

                >
                  <a-date-picker
                      format="YYYY-MM-DD"
                      show-time
                      placeholder="报修日期"
                      v-model.trim="addForm.repair_date"
                      @change="onChangeRepairDate"
                      :allow-clear="true"
                      style='width: 350px;height: 32px;'
                      :disabled="!canBeEdited || !isAdd"
                  />
                </a-form-model-item>

                <a-form-model-item
                    label="报修设备"
                    prop="repairEquipment"
                    style="width: 100%;;margin-left: 26px"
                    >
                  <a-popover  trigger="click" placement="bottom" :overlayStyle="{ width: '350px' }">
                    <template slot="content">
                      <p class="aPopover" v-for="(item,index) in deviceSearchList" :key="index"  @click="changeDevice(item)" >{{
                          'code:'+item.code+',name:'+item.name}}</p>
                    </template>
                    <a-input style='width: 350px;height: 32px'
                             v-model.trim="addForm.device_name"
                             @keydown.enter="getDeviceSearchList(addForm.device_name)"
                             @change="getDeviceSearchList(addForm.device_name)"
                             allowClear
                             @click="getDeviceSearchList(addForm.device_name)"
                             v-auth="`query`" ></a-input>
                  </a-popover>
                </a-form-model-item>

                <a-form-model-item
                    label="报修原因"
                    prop="repairReason"
                    style="width: 100%;margin-left: 26px"
                    >
                  <a-textarea v-model.trim="addForm.repair_reason" show-count style="width: 500px" :maxlength="200" />
                </a-form-model-item>

              </a-form-model>

            </div>
          </div>
        </a-spin>

      </a-modal>
      <!--assignmentTaskModel-->
      <a-modal
          destroyOnClose
          v-model='assignmentTaskModel'
          width='800px'
          :title="isAdd?'任务分配':title"
          @ok="submitAssignmentTask"
          @cancel="handleCancelAssignmentTask"
          :bodyStyle="bodyStyle"
      >
        <a-spin :spinning="spinning">
          <div style="width: 100%;min-height: 30px;display: flex;flex-direction: row;padding: 10px 24px 10px 24px;justify-content: space-between">
            <div style="width: 85%;">
              <a-form-model :model="addForm"  layout="inline">
                <a-form-model-item
                    label="维修责任人"
                    prop="responsiblePerson"
                    style="margin-left: 14px;width: 100%">
                  <a-popover  trigger="click" placement="bottom" :overlayStyle="{ width: '250px' }">
                    <template slot="content">
                      <p class="aPopover" v-for="(item,index) in userSearchList" :key="index"  @click="changeUser(item)" >{{item.name}}</p>
                    </template>
                    <a-input style='width: 250px;height: 32px'
                             v-model.trim="addForm.order_user"
                             @keydown.enter="getUserList(addForm.order_user)"
                             allowClear
                             @change="getUserList(addForm.order_user)"
                             @click="getUserList(addForm.order_user)"
                             v-auth="`query`" ></a-input>
                  </a-popover>
                </a-form-model-item>
              </a-form-model>

            </div>
          </div>
        </a-spin>

      </a-modal>
      <!--adjustmentsTaskModel-->
      <a-modal
          destroyOnClose
          v-model='adjustmentsTaskModel'
          width='800px'
          :title="isAdd?'任务调整':title"
          @ok="submitAdjustments"
          @cancel="handleCancel0Adjustments"
          :bodyStyle="bodyStyle"
      >
        <a-spin :spinning="spinning">
          <div style="width: 100%;min-height: 30px;display: flex;flex-direction: row;padding: 10px 24px 10px 24px;justify-content: space-between">
            <div style="width: 85%;">
              <a-form-model :model="addForm"  layout="inline">


                <a-form-model-item
                    class='optionTitle'
                    label="报修单编码"
                    required
                >
                  <a-input style='width: 200px;height: 32px' v-model='addForm.repairCode'  v-auth="`query`"></a-input>
                </a-form-model-item>

                <a-form-model-item
                    label="维修责任人"
                    prop="responsiblePerson"
                    style="margin-left: 11px;width: 100%">
                  <a-popover  trigger="click" placement="bottom" :overlayStyle="{ width: '250px' }">
                    <template slot="content">
                      <p class="aPopover" v-for="(item,index) in userSearchList" :key="index"  @click="changeUser(item)" >{{item.name}}</p>
                    </template>
                    <a-input style='width: 250px;height: 32px'
                             v-model.trim="addForm.order_user"
                             @keydown.enter="getUserList(addForm.order_user)"
                             @change="getUserList(addForm.order_user)"
                             allowClear
                             @click="getUserList(addForm.order_user)"
                             v-auth="`query`" ></a-input>
                  </a-popover>
                </a-form-model-item>

                <a-form-model-item
                    label="报修日期"
                    prop="date"
                    style="width: 100%;margin-left: 25px"
                >
                  <a-date-picker
                      format="YYYY-MM-DD"
                      show-time
                      allowClear
                      placeholder="报修日期"
                      v-model.trim="addForm.repair_date"
                      @change="onChangeRepairDate"
                      :allow-clear="true"
                      style='width: 350px;height: 32px;'
                      :disabled="!canBeEdited || !isAdd"
                  />
                </a-form-model-item>

                <a-form-model-item
                    label="报修设备"
                    prop="repairEquipment"
                    style="width: 100%;margin-left: 25px"
                >
                  <a-popover  trigger="click" placement="bottom" :overlayStyle="{ width: '350px' }">
                    <template slot="content">
                      <p class="aPopover" v-for="(item,index) in deviceSearchList" :key="index"  @click="changeDevice(item)" >{{
                          'code:'+item.code+',name:'+item.name}}</p>
                    </template>
                    <a-input style='width: 350px;height: 32px'
                             v-model.trim="addForm.device_name"
                             @keydown.enter="getDeviceSearchList(addForm.device_name)"
                             @change="getDeviceSearchList(addForm.device_name)"
                             allowClear
                             @click="getDeviceSearchList(addForm.device_name)"
                             v-auth="`query`" ></a-input>
                  </a-popover>
                </a-form-model-item>

                <a-form-model-item
                    label="报修原因"
                    style="width: 100%;margin-left: 25px"
                >
                  <a-textarea v-model.trim="addForm.repair_reason" show-count style="width: 500px" :maxlength="200" />
                </a-form-model-item>

              </a-form-model>

            </div>
          </div>
        </a-spin>

      </a-modal>


      <page-head-area>
        <div class="extra" style="width: 260px;display: flex;justify-content: space-around">
<!--          <a-badge count="9">-->
            <a-button icon="plus-circle" v-auth="`insert`" @click="add" style="background-color: #fff;border: none;margin-left: 10px;width: 70px;height: 35px;">新增</a-button>
<!--          </a-badge>-->
          <a-popconfirm title="确定删除?" @confirm="delOrder">
            <a-button icon="delete" v-auth="`delete`" style="background-color: #fff;border: none;margin-left: 10px;width: 70px;height: 35px;">删除</a-button>
          </a-popconfirm>

            <a-button icon="audit"  style="background-color: #fff;border: none;margin-left: 10px;width: 70px;height: 35px;">审核</a-button>
        </div>
      </page-head-area>

      <div class="queryBox">
        <a-form-model layout="inline" :model='queryForm'  class='query' style='display: flex;flex-wrap: wrap;'>
          <a-form-model-item
              class='optionTitle'
              label="设备编码"
              style="margin-left: 0"
          >
            <a-input style='width: 200px;height: 32px' v-model='queryForm.device_code'  v-auth="`query`"></a-input>
          </a-form-model-item>
          <a-form-model-item
              class='optionTitle'
              label="设备名称"
              prop="name"
          >
            <a-input style='width: 200px;height: 32px' v-model='queryForm.device_name' v-auth="`query`"></a-input>
          </a-form-model-item>


          <a-form-model-item
              label="审核状态"
          >
            <a-select
                style='width: 150px'
                allowClear
                v-model.trim='queryForm.audit_status'
                v-auth="`query`"
            >
              <a-select-option
                  v-for='item in auditStatusList'
                  :key='item.code'
                  :value='item.code'
              >{{item.description}}</a-select-option>
            </a-select>
          </a-form-model-item>

          <a-form-model-item
              label="日期范围"
          >
            <a-range-picker
                :valueFormat="'YYYY-MM-DD'"
                style="width: 300px;"
                :format="'YYYY-MM-DD'"
                v-model.trim="queryForm.dateSelect"
                :allow-clear="true"/>
          </a-form-model-item>

          <a-form-model-item>
            <a-button type='primary' style='height: 32px;width: 70px;text-align: center' @click="reset" v-auth="`query`">
              重置
            </a-button>
          </a-form-model-item>

          <a-form-model-item>
            <a-button type='primary' style='height: 32px;width: 70px;text-align: center' @click="filter" v-auth="`query`">
              搜索
            </a-button>
          </a-form-model-item>
        </a-form-model>
      </div>
      <div class="dataBox">
        <a-table
            :columns="columns"
            :data-source="data"
            :pagination="false"
            :loading="tableLoading"
            :rowKey="(recordS) => {return recordS.id}"
            :scroll="{ x: 1000, y: 500 }"
            :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
        >
          <template slot="action" slot-scope="record">
            <div v-if="record.responsible_user_id===null">
              <a v-auth="`update`" @click="assignmentTask(record)">任务分配</a>
            </div>

            <div v-if="record.responsible_user_id!==null">
              <a v-auth="`update`" @click="adjustmentsTask(record)">任务调整</a>
            </div>

          </template>
        </a-table>

      </div>

      <a-pagination
          @change="onChangePage"
          @showSizeChange="showSizeChange"
          :total="pagination.total"
          :showSizeChanger="true"
          :showQuickJumper="true"
          :defaultPageSize="pagination.defaultPageSize"
          :pageSize="pagination.page_size"
          :pageSizeOptions="pagination.pageSizeOptions"
          :current="pagination.current"
          :showTotal="pagination.showTotal"
          style="width: 100%;display: flex;flex-direction: row;justify-content: flex-end;margin-top: 15px"
      ></a-pagination>
    </a-card>
  </div>
</template>

<script>

import {mapGetters} from "vuex";
import PageHeadArea from "../module/pageHeadArea.vue";
import pagination from "ant-design-vue/lib/pagination";
import storage from "store";
import {DEPT_ID, ORGANIZATION_ID, USER_TOKEN} from "@/store/mutation-types";
import axios from "axios";
import moment from "moment";
import {
  file_import, file_upload,
  get_employee_list,
  get_extended_define, get_asset_file_list, get_supplier, get_unit_list, download_file,
  get_organization_list,
  delete_asset, get_asset_list, save_asset, update_asset,
  get_category_type_list, get_organization_profile_list, get_template_list, update_extend
} from "@/services/manage";
import {
  deleteDeviceRepairOrder, getCacheByVaguename,
  getDeviceList,
  getUserNameById,
  listDeviceRepairAll,
  listDeviceRepairOrderAll, saveDeviceRepairOrder
} from "../../utils/interface";
import {message} from "ant-design-vue";
import {list_device_repair_order_all} from "../../services/deviceRepair";
const data = []
const columns = [
  { title: '报修单号', width: 120, align:'center',dataIndex: 'code', key: 'code'},
  { title: '设备编码', width: 120, align:'center',dataIndex: 'device_code', key: 'device_code'},
  { title: '报修人', width: 120, align:'center',dataIndex: 'create_user_name', key: 'create_user_name'},
  { title: '设备名称', width: 120, align:'center',dataIndex: 'device_name', key: 'device_name'},
  { title: '报修日期', width: 120, align:'center',dataIndex: 'create_time', key: 'create_time'},
  { title: '故障原因', width: 120, align:'center',dataIndex: 'fault_reason', key: 'fault_reason'},
  { title: '状态', width: 120, align:'center',dataIndex: 'status_name', key: 'status_name'},
  { title: '责任人', width: 120, align:'center',dataIndex: 'responsible_user_name', key: 'responsible_user_name'},
  {
    title: '操作',
    align:'center',
    key: 'operation',
    fixed: 'right',
    width: 180,
    scopedSlots: { customRender: 'action' }
  }
]

export default {
  name: "userAuthority",
  components: {PageHeadArea},
  data() {
    return {
      adjustmentsTaskModel:false,
      record:{},
      assignmentTaskModel:false,
      deviceSearchList:[],
      userSearchList:[],
      addForm:{
        repairCode:undefined,
        order_user:undefined,
        order_user_id:undefined,
        repair_date:'',
        device_id:undefined,
        device_name:undefined,
        repair_reason:''
      },
      selectedRowKeys:[],
      auditStatusList:[
        {code:null,description: '不限'},
        { code: 0, description: "未审核" },
        { code: 1, description: "已审核" }],
      tableLoadingAdd:false,
      tableLoading01: false,
      axiosSource: null,
      tabKey: '1',
      title:'',
      tabBarGutter: 0,
      tabBarStyle: {
        color: 'rgba(0, 0, 0, 0.85)'
      },
      bodyStyle: {
        'padding': '0px 24px 0px 24px',
        'font-size': '14px',
        'line-height': '1.5',
        'word-wrap': 'break-word',
      },
      cardMinHeight: 0,
      queryForm: {
        device_code: '',
        device_name: '',
        audit_status:undefined,
        dateSelect:[],
      },
      statusList: [
        // {id: 1, name: '待采购', code: '0', type: 'use_status'},
        {id: 1, name: '正常运行', code: '1',type: 'use_status'},
        {id: 2, name: '不正常运行', code: '2',type: 'use_status'},
      ],
      data,
      columns,
      pagination: {
        total: 0,
        page_size: 10,
        defaultPageSize: 10,
        page: 1,
        current: 1,
        showSizeChanger: true,
        showQuickJumper: true,
        showTotal: total => `共 ${total} 条记录`,
        pageSizeOptions: ['10', '20', '50', '100', '500'],
      },
      tableLoading: false,
      addModal: false,
      canBeEdited: false, //是否可编辑
      isAdd: false, //是否为新增
      spinning: false,

      detailModal:false, //详情弹窗
      canBeQuery:false, //是否可查询

      maintenance_detailsModal:false,
      key1Pagination: {
        total: 0,
        page_size: 4,
        defaultPageSize: 4,
        page: 1,
        current: 1,
        showSizeChanger: true,
        showQuickJumper: true,
        showTotal: total => `共 ${total} 条记录`,
        pageSizeOptions: ['4', '8', '10', '20', '50'],
      }
    }
  },
  watch: {},
  authorize: {
    add: 'insert',
    getAssetLedgerList: 'query',
    reset: 'query',
    query: 'query',
    detail: 'query',
    edit: 'update',
    del: 'delete',
    check: 'check',
  },
  computed: {
    ...mapGetters(['getCardMinHeight']),
  },
  created() {
    this.cardMinHeight = this.getCardMinHeight
  },
  async mounted() {
    this.axiosSource = axios.CancelToken.source();


    await this.initialize()

  },
  methods: {
    adjustmentsTask(record){
      this.clearParameter()
      this.record=record
      this.canBeEdited = true
      this.isAdd = true
      console.log(record)
      this.addForm.repairCode=record.code
      this.addForm.device_id=record.device_id
      this.addForm.device_name=record.device_name
      this.addForm.repair_reason=record.fault_reason
      this.addForm.repair_date=record.create_time
      this.addForm.order_user=record.responsible_user_name
      this.addForm.order_user_id=record.responsible_user_id
      this.adjustmentsTaskModel= true
    },
    handleCancelAssignmentTask(){
      this.canBeEdited = false
      this.isAdd = false
      this.clearParameter()
      this.assignmentTaskModel= false
    },
    assignmentTask(record){
      this.record=record
      this.canBeEdited = true
      this.isAdd = true
      this.assignmentTaskModel= true
    },
    onSelectChange(selectedRowKeys){
      // console.log('selectedRowKeys changed: ', selectedRowKeys);
      this.selectedRowKeys = selectedRowKeys
    },
    // async auditSelect() {
    //   for (const item of this.selectedRowKeys) {
    //     await saveDeviceRepairOrder({'id': item,'status':1}).then(res => {
    //       console.log(res)
    //     })
    //   }
    //   this.selectedRowKeys=[]
    //   message.info('审核成功')
    //   await this.initialize()
    // },
    async delOrder() {
      // console.log(this.selectedRowKeys)
      for (const item of this.selectedRowKeys) {
        await deleteDeviceRepairOrder({'id': item})
      }
      this.selectedRowKeys=[]
      message.success('删除成功')
      await this.initialize()
    },
    async filter() {
      //筛选
      this.pagination.page = 1
      this.pagination.current = 1
      this.pagination.page_size = 10
      this.tableLoading = true
      await this.initialize({
        'status':this.queryForm.audit_status
      })
      // 获取时间范围
      const [startDate, endDate] = this.queryForm.dateSelect;
      console.log(this.queryForm.dateSelect)
      this.data = this.data.filter(item => {
        // 检查每个条件是否满足
        return (
            (this.queryForm.device_code ? item.device_code.includes(this.queryForm.device_code) : true) &&
            (this.queryForm.device_name ? item.device_name.includes(this.queryForm.device_name) : true) &&
            (startDate ? new Date(item.create_time) >= new Date(startDate) : true) &&
            (endDate ? new Date(item.create_time) <= new Date(endDate) : true)
        );
      });
      this.tableLoading = false;
    },
    async initialize(params) {
      this.data=[]
      this.tableLoading =true
      const paramsAll = Object.assign({}, params, {
        "page": this.pagination.page,
        "page_size": this.pagination.page_size
      });


      await list_device_repair_order_all(paramsAll).then(async res => {
        // console.log(res)
        if(res.data.code === '1000'){
          this.pagination.total = res.data.extension.total+(this.pagination.current-1)*this.pagination.page_size
          for (const item of res.data.data) {
            let searchDevice = await getDeviceList({'id': item.device_id})
            item['device_name'] = searchDevice[0]?.name || ''
            item['device_code'] = searchDevice[0]?.code || ''
            item['create_user_name'] = await getUserNameById(item.create_user)
            if(item.responsible_user_id!==null){
              item['responsible_user_name'] = await getUserNameById(item.responsible_user_id)
            }else {
              item['responsible_user_name'] = ''
            }
            item['status_name'] = this.auditStatusList.find(it=>it.code===item.status)?.description || ''
          }
        }
        this.data=res.data.data
      })
      this.tableLoading =false
    },
    onChangeRepairDate(value, dateString){
      this.addForm.repair_date = dateString
    },
    // 分页切换
    onChange (pagination) {
      this.pagination.current = pagination.current
      this.pagination.page_size = pagination.pageSize
      this.pagination.page = pagination.current
      this.getAssetLedgerList()
    },
    // 分页切换
    onChangeKey1 (pagination) {
      this.key1Pagination.current = pagination.current
      this.key1Pagination.page_size = pagination.pageSize
      this.key1Pagination.page = pagination.current
    },
    async query() {
      this.tableLoading = true
      this.pagination.page = 1
      this.pagination.current = 0
      this.pagination.page_size = 10
      await this.initialize()
      this.tableLoading = false
    },
    reset() {
      this.queryForm = {
        device_code: '',
        device_name: '',
        audit_status:undefined,
        dateSelect:[],
      }
      this.query()
    },
    add() {
      this.addModal = true
      this.canBeEdited = true
      this.isAdd = true
      this.spinning = false
    },
    edit(record) {
      this.addModal = true
      this.canBeEdited = true
      this.isAdd = false
      this.echo(record)
    },
    changeUser(item){
      this.addForm.order_user=item.name;
      this.addForm.order_user_id= item.id
      // console.log(record1)
    },
    onChangePage (page, pageSize) {
      this.pagination.current = page
      this.pagination.page_size = pageSize
      this.pagination.page = page
      this.initialize()
    },
    showSizeChange(current, size){
      this.pagination.page_size = size
      this.pagination.current = current
      this.pagination.page = current
      this.initialize()
    },
    changeDevice(item){
      this.addForm.device_name = item.name
      this.addForm.device_id= item.id
    },
    async getUserList(order_user) {
      this.userSearchList = []
      await getCacheByVaguename(order_user).then(res=>{
        res.slice(0, 10).forEach(item => {
          this.userSearchList.push({
            id: item.id,
            name: item.name
          })
        })
      })
      // console.log(this.userSearchList)
    },
    async getDeviceSearchList(device_name) {
      this.deviceSearchList=[]
      // await
      await getDeviceList({'name':device_name}).then(res=>{
        res.slice(0, 10).forEach(item => {
          this.deviceSearchList.push({
            id: item.id,
            name: item.name
          })
        })
      })
      // console.log(this.deviceSearchList)
    },
    detail(record) {
      this.detailModal = true
      this.canBeEdited = false
      this.canBeQuery =true
      this.isAdd = false
      this.echo(record)
    },
    clearParameter() {
      this.addForm={
        repairCode:undefined,
        order_user:undefined,
        order_user_id:undefined,
        repair_date:'',
        device_id:undefined,
        device_name:undefined,
        repair_reason:''
      }
      this.record={}
      this.deviceSearchList=[]
      this.userSearchList=[]
    },
    handleCancel() {
      this.tabKey = '1'
    },
    handleCancel0() {
      this.addModal = false
      this.clearParameter()
      this.canBeEdited = false
      this.isAdd = false
    },
    handleCancel0Adjustments(){
      this.adjustmentsTaskModel = false
      this.clearParameter()
      this.canBeEdited = false
      this.isAdd = false
    },
    async submitAdjustments() {
      // console.log(this.addForm)
      if (this.addForm.repairCode === undefined || this.addForm.repairCode === '') {
        message.error('请输入设维修单编码')
        return
      }

      if (this.addForm.device_id === undefined || this.addForm.device_id === ''
          || this.addForm.device_name === undefined || this.addForm.device_name === '') {
        message.error('请选择设备')
        return
      }
        await saveDeviceRepairOrder({
          'id':this.record.id,
          'code': this.addForm.repairCode,
          'device_id': this.addForm.device_id,
          'fault_reason': this.addForm.repair_reason,
          'responsible_user_id': this.addForm.order_user_id,
          'create_time': this.addForm.repair_date

        })
        this.handleCancel0Adjustments()
        await this.initialize()
        message.success('调整成功')
    },
    async submit() {
      // console.log(this.addForm)
      if(this.addForm.repairCode=== undefined){
        message.error('请填写报修单号')
        return
      }
      if (this.addForm.device_id === undefined
          || this.addForm.device_id === ''
          || this.addForm.device_name === undefined
          || this.addForm.device_name === '') {
        message.error('请选择设备')
        return
      }
      // if (this.addForm.order_user_id === undefined) {
      //   message.error('请选择报修人')
      //   return
      // }
      // if (this.addForm.repair_date === '') {
      //   message.error('请选择报修日期')
      //   return
      // }
      // if (this.addForm.repair_reason === '') {
      //   message.error('请填写报修原因')
      //   return
      // }

        await saveDeviceRepairOrder({
          'code': this.addForm.repairCode,
          'device_id': this.addForm.device_id,
          'fault_reason':this.addForm.repair_reason,
          'create_user':this.addForm.order_user_id,
          'create_time':this.addForm.repair_date

        })
        this.handleCancel0()
        await this.initialize()
        message.success('新增成功')
    },
    async submitAssignmentTask() {
      // console.log(this.addForm)
      // console.log(this.record)

      await saveDeviceRepairOrder({'id': this.record.id, 'responsible_user_id': this.addForm.order_user_id})
      message.success ('分配成功')
      this.handleCancelAssignmentTask()
      await this.initialize()

    },
  },
  beforeDestroy() {
    if (this.axiosSource) {
      this.axiosSource.cancel('Request canceled due to page navigation.');
    }
  }
}
</script>

<style scoped lang="less">
.aPopover{
}
.aPopover:hover {
  background-color: #EA5413;
}

.dataBox{
  margin-top: 20px;
}

.hide-scrollbar::-webkit-scrollbar {
  display: none; /* 隐藏滚动条 */
}

::-webkit-scrollbar {
  display: none; /* 隐藏滚动条 */
}
.hide-scrollbar {
  -ms-overflow-style: none;  /* IE 和 Edge */
  scrollbar-width: none;  /* Firefox */
  overflow-y: scroll; /* 保持内容可滚动 */
}
.demo-infinite-container {
  margin-top: 0px;
  border: 1px solid #e8e8e8;
  border-radius: 4px;
  overflow: auto;
  padding: 8px 24px;
  height: 300px;
}
/deep/ .ant-form-inline .ant-form-item-with-help{
  margin-bottom: 0px;
}
/deep/ .ant-input[disabled]{
  pointer-events: none;
  color: #000000d9;
  background-color: #f5f5f5;
  cursor: not-allowed;
  opacity: 1;
}
/deep/ .unit .ant-select-selection--single{
  margin-left: 0px;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left: 0;
}
/deep/ .ant-select-disabled .ant-select-selection {
  background-color: #fff;
}
/deep/ .ant-input[disabled]{
  pointer-events: none;
  color: #000000d9;
  background-color: #fff;
  cursor: not-allowed;
  opacity: 1;
}
/deep/ .ant-input-number-disabled{
  pointer-events: none;
  color: #000000d9;
  background-color: #fff;
  cursor: not-allowed;
  opacity: 1;
}
</style>